Accusoft.ImagXpress13.ActiveX
Save Image to File

When an image is stored to file, the current image buffer (ProcessImageID property) within ImagXpress® remains unchanged, but the contents of the image buffer store to a file.

Saving an Image to File

To save an image to file, first verify that save options are set for the file type you are saving. Then, set the SaveFileName property to the path and filename you wish to save to. ImagXpress automatically saves the image as the type specified by the file extension, if the SaveFileType property is set to 0 (FT_DEFAULT). 

VB Example
Copy Code
ImagXpress1.SaveFileName = "C:\IMAGXPRESS\XYZ.JPG" 
ImagXpress1.SaveFile

ImagXpress converts and compresses the image to the file format specified and saves it to the target location. While ImagXpress is compressing and saving the image, you can check the ProcessStatus property to understand the current status of the process. If the file is extremely large and requires heavy compression and the computer is slow, then it could take more than a few seconds to encode the image. 

Saving a Multi-page Image

ImagXpress supports the following multi-page image formats: TIFF, ICO, and DCX. Multi-page images can be compressed and saved.

ImagXpress does not support saving to a multi page image at an HTTP or FTP location. 

To compress and save a multi page image to file, you need to:

  1. Set the SaveMultiPage property to True, indicating that the image appends to a multi-page document.
  2. Then loop through the images to be appended.  
VB Example
Copy Code
' Assume ten images are stored in image buffers 500-509
Dim i as Integer
Dim nImageCount as Integer
nImageCount = 10
ImagXpress1.SaveFileType = FT_TIFF_G4
ImagXpress1.SaveFileName = "C:\images\newmulti.tif"
ImagXpress1.SaveMultiPage = True
ImagXpress1.ProcessImageID = 500
For i = 1 to nImageCount 
    ImagXpress1.SaveFile
    ImagXpress1.ProcessImageID = ImagXpress1.ProcessImageID + 1
Next i 

Fast Saving of Multi-page TIFF Files (generally over 1000 pages)

When the SaveUseIFDOffset property is false (default), the image is appended to the end of the multi-page TIFF. Due to the linked format of TIFF, the software must traverse all the link pointers to identify the location to which the new page will be appended. The greater the number of pages in the target TIFF file, the longer the write process takes. (Typically, if the target file has more than 1000 pages, the write speed will degrade substantially.

Setting the SaveUseIFDOffset property to true specifies that the control should write the image to the location stored in the SaveIFDOffset property. This enables much faster writing of TIFF files with many pages because the software can seek to that location without traversing all previous pointer links. This process gives very predictable speeds in adding pages to a multi-page TIFF file.

Important:

If the file's IFDOffset ever became out of sync with the SaveIFDOffset property value, file corruption could occur. To protect the application from inadvertently corrupting a saved mutli-page file, the ImagXpress control takes the following measures:

No other operation with the TIFF file should be done during the looping of saving the pages with a fast TIFF write. It would be detrimental to call either the FileGetTags, FileSetTags, CompactFile, DeletePage, or InsertPage methods in the middle of doing a fast TIFF write as they would definitely affect the IFD offsets in the file.

The following example illustrates how to use the SaveUseIFDOffset and SaveIFDOffset properties to safely enable fast TIFF writing. 

VB Example
Copy Code
myIFDOffset = 0
 
  For i = 1 To MaxCount
 
        ImagXpress1.FileName = OpenName
        ‘ SaveUseIDFOffset is reset to Falseand SaveIDFOffset is reset to zero
 
        ‘ Specify that the fast TIFF writing should be used to append
        ‘ the next page to the multi-page TIFF
        ‘ Specify the SaveIFDOffset to which the image will be written.
        ImagXpress1.SaveMultiPage = True
        ImagXpress1.SaveFileName =  “Multipage.tif”
        ImagXpress1.SaveTIFFCompression = TIFF_CCITTFAX4
 
        ‘ Save the image to the multi-page file
        ImagXpress1.SaveFileType = FT_TIFF
        If FastTiffChk.Value = 1 Then
            ImagXpress1.SaveUseIFDOffset = True
        Else
             ImagXpress1.SaveUseIFDOffset = False
      
        End If
       
        ImagXpress1.SaveIFDOffset = myIFDOffset
        ImagXpress1.SaveFile
        ‘ SaveUseIFDOffset is now reset to false.
        ‘ SaveIFDOffset is set to the new IFDOffset
        ‘ to which the next page should be appended.
 
        ‘ Read the SaveIFDOffset property and temporarily store it away for
        ‘ reuse the next time the output file is appended.
        myIFDOffset = ImagXpress1.SaveIFDOffset
 
Next i
See Also

 

 


©2015. Accusoft Corporation. All Rights Reserved.

Send Feedback